package xhwl.insurance.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.insurance.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by Administrator on 2017/11/30.
 */

public class SendVoiceApi  extends BaseApi {


    private final SendVoiceReq req;

    public SendVoiceApi(String member_id, String jg_id,String talk_type,String app_key, String talk_content, String image_picurl, String voice_format, String client_type) {
        req = new SendVoiceReq(member_id,jg_id,talk_type,app_key,talk_content,image_picurl,voice_format,client_type);
        setShowDialog(true);
        setCancle(false);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).SendVoice(requestBody);
    }

    private class SendVoiceReq {
        private String member_id;
        private String jg_id;
        private String talk_type;
        private String app_key;
        private String talk_content;
        private String image_picurl;
        private String voice_format;
        private String client_type;
        public SendVoiceReq(String member_id, String jg_id,String talk_type,String app_key, String talk_content, String image_picurl, String voice_format, String client_type) {
            super();
            this.member_id = member_id;
            this.jg_id = jg_id;
            this.talk_type = talk_type;
            this.app_key = app_key;
            this.talk_content = talk_content;
            this.image_picurl = image_picurl;
            this.voice_format = voice_format;
            this.client_type = client_type;
        }
    }
}
